package com.baiyimi.java.redis.web.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;


@Service
public class HelloWorldService {


    @Autowired
    private StringRedisTemplate stringRedisTemplate;


    public void demo1ForSet() {
        stringRedisTemplate.opsForValue().set("hello", "world");
    }

    public String demo1ForGet() {
        String hello = stringRedisTemplate.opsForValue().get("hello");
        System.out.println("demo1ForGet:" + hello);
        return hello;
    }
}
